Ext.define('AmpleHarvest.util.solrQueryBuilder', 
{
    extend			: 'Ext.util.Observable',
    listenerName	: 'dataResponse',
    id				: '',
    listeners		:
	{
		responseFailure	: function(e)
		{
			//console.log(e);
		},
		
		responseSuccess	: function()
		{
			this.AHcaller.fireEvent(this.listenerName, this.obj_return);
		}
	},
	
	constructor	: function(config)
	{
		this.addEvents('responseFailure', 'responseSuccess');
		this.callParent();
	},
	
	//TODO : use this utility to create a universal solr querry manager
	
	get_QueryString		: function(obj_form)
    {
    	var obj_Tmp = new Object();
    	var obj_Form = obj_form.getFields();
    	var str_query = '';
    	var str_and	= ' AND ';
    	var str_or	= ' OR ';
    	var str_not = ' NOT ';
    	
    	for (int_I in obj_Form.items)
        {
           obj_Tmp = new Object();
           
           var obj_Item = obj_Form.items[int_I];
           
           if (!obj_Item.getValue())
           {
 				continue;
           }
           
           if (obj_Item)
           {
        	   if(obj_Item.name == 'general')
        	   {
        		   str_query = obj_Item.getValue();
        		   continue;
        	   }
        	   
        	   if(str_query.length > 0)
        	   {
        		   str_query += str_and;
        	   }
        	   
        	   str_query += obj_Item.searchTerm+':'+obj_Item.getValue();
           }
    	}
//    	console.log(str_query);
    	return(str_query);
    }	
});